define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'phonelist/index' + location.search,
                    add_url: 'phonelist/add',
              
                    multi_url: 'phonelist/multi',
                    import_url: 'phonelist/import',
                    table: 'phonelist',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {field: 'jf', title: __('Jf'), operate: 'LIKE', table: table},
                        {field: 'phone', title: __('Phone'), operate: 'LIKE', table: table},
                        {field: 'click', title: __('银行点击'), operate: 'LIKE', table: table},
                        {field: 'type', title: __('Type')},
                        {field: 'gsd', title: __('Gsd'), operate: 'LIKE', table: table},
                        {field: 'time', title: __('下单时间'), operate: 'LIKE', table: table},
                        {field: 'yy', title: __('未下单原因'), operate: 'LIKE', table: table},
                        {field: 'uptotwo', title: __('第二页数据'), operate: 'LIKE', table: table},
                        {field: 'ifyz', title: __('是否输入验证码'), operate: 'LIKE', table: table},
                        {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                        {field: 'dyurl', title: __('对应链接'), operate: 'LIKE', formatter: Table.api.formatter.url},

                        {field: 'mt', title: __('媒体'), operate: 'LIKE', table: table},
                       
                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });
           
            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});
